from django.db import models
from django.contrib.contenttypes.models import ContentType

class TaggedItem(models.Model):
    slug = models.SlugField()
    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = models.GenericForeignKey()

    def __str__(self):
        return self.slug
    
    class Meta:
        ordering = ('-id',)
        get_latest_by = 'id'